﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

    /*
    * Using ActiveRecord pattern 
    */

using DbManager.Objects;
using DbManager.Query;

namespace DbManager
{

   /* Base class for ActiveRecord */
    public class ActiveEntityBase<TDbManager, TEntity, TKey>
        where TDbManager : DbManager, new()
        where TEntity : ActiveEntityBase<TDbManager, TEntity, TKey>, new()
        where TKey : struct
    {

        #region Static Members

        public static List<TEntity> Find()
        {
            using (TDbManager db = new TDbManager())
            {
                SqlQuery<TEntity> query = new SqlQuery<TEntity>();
                return query.SelectAll();
            }
        }

        #endregion
    }

}
